-- vim:set sw=4 sts=4 et:

socket = require 'socket'
s = assert(socket.udp())
assert(s:setoption('broadcast', true))
assert(s:setpeername('255.255.255.255', 3401))

for line in io.lines(arg[1]) do
    assert(s:send(line))
    socket.select(nil, nil, tonumber(arg[2] or '1'))
end

assert(s:close())
